A distributed system may contain multiple nodes interconnected by a computer network. A node may be any form of computing device, such as a computer, mobile device, tablet, industrial machine, or a machine on the Internet of Things, to name but a few non-limiting examples. Each node may comprise a clock. The clock may for example comprise an oscillator and may form part of a processing circuit, such as a central processing unit (CPU) or graphics processing unit (GPU) for example. The accuracy or operating conditions of each clock may vary in relation to those of the others. These differences may lead to drift between the clocks at different network nodes. Such drift may be considered undesirable, e.g. when it is desirable or necessary to synchronize events occurring at different nodes within the distributed system.
The IEEE 1588 Precision Time Protocol (PTP) defines a standardized method for synchronizing clocks over a network. PTP synchronization (i.e. synchronization according to IEEE 1588) involves a predetermined exchange of messages including a SYNC message, a DELAY_REQ message, and a DELAY_RESP message (the messages also being referred to as “packets” or “frames”). The exchange is initiated by the master clock and yields four timestamps, which are commonly identified using the identifiers t1, t2, t3 and t4 (or, in some references, as T1, T1′, T2 and T2′ respectively). The first two timestamps t1 and t2 indicate a time of transmission and a time of receipt, respectively, of a message sent from the master clock to the slave clock. The second two timestamps t3 and t4 indicate a time of transmission and a time of receipt, respectively, of a message sent in the opposite direction, from the slave clock to the master clock.
The slave clock uses the timestamps t1, t2, t3 and t4 to compute an offset between itself and the master clock. This is done using a predetermined algorithm, defined in the IEEE 1588 standard, which is referred to herein as the “PTP clock offset algorithm.” The relative simplicity of the PTP clock offset algorithm, i.e. requiring only timestamps t1, t2, t3 and t4 to compute the offset, is made possible by a number of assumptions upon which the algorithm is premised. One such assumption is that the propagation delay of a message traveling over a network between the master clock and the slave clock is the same in both directions.
Once the slave clock has computed the offset using the PTP clock offset algorithm, the slave clock adjusts itself to eliminate the offset. In this way, each slave clock independently synchronizes itself with the master clock. This may be done at periodic intervals.
Some distributed systems may employ a pair of redundant computer networks between system nodes for increased reliability. For example, the IEC 62439-3 standard defines the Parallel Redundancy Protocol (PRP) and High-availability Seamless Redundancy (HSR) protocol, which may be used for this purpose. In a distributed system comprised of PRP/HSR devices (i.e. devices that are compliant with either or both of these protocols) communicating over a pair of redundant networks, the redundant networks provide two available paths for messages between each pair of network devices. According to the PRP/HSR protocols, each message originating from a source node is duplicated to create a pair of redundant messages. The pair of redundant messages is sent over the pair of redundant networks respectively. If one of the redundant networks fails, or one of the messages is dropped, the redundant (duplicate) message being carried by the other redundant network may still reach its destination. In this way, reliability may be improved. Any duplicate messages detected at the receiving end are removed.
In a distributed system employing redundant networks (e.g. using PRP/HSR), the redundant networks may be transparent to upper layer entities at the source and destination nodes that communicate through lower layer modules/devices (e.g. PRP/HSR modules/devices). Because the redundancy may be hidden from the communicating entities, it may be unclear to those entities whether a message successfully transmitted from a source node to a destination node was carried by the same redundant network as a message successfully transmitted in the opposite direction between those nodes. If each of the redundant networks imparts a different propagation delay to a message carried between these nodes, it may not be safe to assume that the propagation delay experienced by messages sent between a pair of communication entities is the same in both directions.